// @ts-ignore
/* eslint-disable */
import request from '@/utils/request'

/** 此处后端没有提供注释 POST /order/add */
export async function addOrder(
  body: {
    order: MallService.BizOrder,
    stockDecreaseRequests: MallService.StockDecreaseRequest[],
  //   stockRequestss:Array<{
  //   productId?: number;
  //   quantity?: number;
  // }>
  }, 
  options?: { [key: string]: any }
) {
  return request<boolean>(`/mall/order/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 DELETE /order/deleteByOrderNo/${param0} */
export async function deleteByOrderNo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.deleteOrderByOrderNoParams,
  options?: { [key: string]: any }
) {
  const { orderNo: param0, ...queryParams } = params
  return request<boolean>(`/mall/order/deleteByOrderNo/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 DELETE /order/deleteorder/${param0} */
export async function deleteOrder(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.deleteOrderParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params
  return request<boolean>(`/mall/order/deleteorder/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /order/getall */
export async function getAllOrders(options?: { [key: string]: any }) {
  return request<MallService.BizOrder[]>(`/mall/order/getall`, {
    method: 'GET',
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /order/page */
export async function getOrdersByPage(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.getOrdersByPageParams,
  options?: { [key: string]: any }
) {
  return request<MallService.PageBizOrder>(`/mall/order/page`, {
    method: 'GET',
    params: {
      // current has a default value: 1
      current: '1',
      // size has a default value: 10
      size: '10',
      ...params,
    },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /order/searchbyid/${param0} */
export async function getOrderById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.getOrderByIdParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params
  return request<MallService.BizOrder>(`/mall/order/searchbyid/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 PUT /order/update */
export async function updateOrder(body: MallService.BizOrder, options?: { [key: string]: any }) {
  return request<boolean>(`/mall/order/update`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /order/user/${param0} */
export async function getOrdersByUserId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.getOrdersByUserIdParams,
  options?: { [key: string]: any }
) {
  const { userId: param0, ...queryParams } = params
  return request<MallService.BizOrder[]>(`/mall/order/user/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}
